%%

trials=100000;

wins=zeros(trials,1);
choice=1;

for ii=1:trials
   car=ceil(3*rand) ;
   if car==2||car==1
       choice=2;
   else
       choice=3;
   end
   if choice==car
       wins(ii)=1;
   else
       wins(ii)=0;
   end   
    
end

winpercent=sum(wins)/trials


